// 191.位1的个数
package Leetcode_Second_Brush;

public class Solution191 {
    public int hammingWeight(int n) {
        int count = 0;
        while (n != 0) {
            int lastbit = n & 1;
            n >>>= 1;
            if (lastbit == 1)
                count++;
        }
        return count;
    }
}
